﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="AccRequest.aspx.cs" Inherits="SwenAssigment.AccRequest" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
    .auto-style5 {
        width: 92px;
    }
    .auto-style6 {
        width: 550px;
    }
    .auto-style7 {
        width: 511px;
    }
    .auto-style8 {
        width: 482px;
    }
    .auto-style9 {
            width: 366px;
        }
    .auto-style10 {
        width: 92px;
        height: 20px;
    }
    .auto-style11 {
        width: 366px;
        height: 20px;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Account Request</h1>
    <div>

        <table style="width: 100%;">
            <tr>
                <td class="auto-style10">Search by</td>
                <td class="auto-style11"></td>
                <td class="auto-style4"></td>
            </tr>
            <tr>
                <td class="auto-style5">Request Id:</td>
                <td class="auto-style9">
                    <asp:TextBox ID="TextBox2" runat="server" ValidationGroup="a"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox2" ErrorMessage="*Require" ForeColor="Red" ValidationGroup="a"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox2" ErrorMessage="*Only allow Number" ForeColor="Red" ValidationExpression="[0-9]{1,}$" ValidationGroup="a"></asp:RegularExpressionValidator>
                </td>
                <td>
                    <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="Search" ValidationGroup="a" />
                </td>
            </tr>
            <tr>
                <td class="auto-style5">Request Name:</td>
                <td class="auto-style9">
                    <asp:TextBox ID="TextBox3" runat="server" ValidationGroup="b"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox3" ErrorMessage="*Require" ForeColor="Red" ValidationGroup="b"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBox3" ErrorMessage="*Allow only letter min 4 max 20" ForeColor="Red" ValidationExpression="[a-zA-Z]{4,20}$" ValidationGroup="b"></asp:RegularExpressionValidator>
                </td>
                <td>
                    <asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="Search" ValidationGroup="b" />
                </td>
            </tr>
            <tr>
                <td class="auto-style5">Status:</td>
                <td class="auto-style9">
                    <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True">
                        <asp:ListItem>Pending</asp:ListItem>
                        <asp:ListItem>Approved</asp:ListItem>
                        <asp:ListItem>Reject</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Button ID="Button5" runat="server" OnClick="Button5_Click" Text="Search" />
                </td>
            </tr>
            <tr>
                <td class="auto-style5">&nbsp;</td>
                <td class="auto-style9">&nbsp;</td>
                <td>
                    <asp:Button ID="Button6" runat="server" OnClick="Button6_Click" Text="Display all" />
                </td>
            </tr>
        </table>
    </div>
    <div>


        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Request_Id,Status" OnRowDeleting="GridView1_RowDeleting" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="5">
            <Columns>
                <asp:BoundField DataField="Request_Id" HeaderText="Request No" />
                <asp:BoundField DataField="Requester_Id" HeaderText="Requester Id" />
                <asp:BoundField DataField="Staff_Name" HeaderText="Staff Name" />
                <asp:BoundField DataField="NRIC" HeaderText="NRIC" />
                <asp:BoundField DataField="Job" HeaderText="Job" />
                <asp:BoundField DataField="Contact_Number" HeaderText="Contact" />
                <asp:BoundField DataField="sUName" HeaderText="User Name" />
                <asp:BoundField DataField="rRole" HeaderText="Access Level" />
                <asp:TemplateField HeaderText="Status">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# "Current Status: "+Eval("Status") %>'></asp:Label>
                        <br />
                        <br />
                        Change To:
                        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" SelectedValue='<%# Eval("Status") %>'>
                            <asp:ListItem Value="Pending"></asp:ListItem>
                            <asp:ListItem>Approved</asp:ListItem>
                            <asp:ListItem>Reject</asp:ListItem>
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField SelectText="Save" ShowCancelButton="False" ShowSelectButton="True" />
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete" OnClientClick="return confirm('confirm to delete?');" Text="Delete"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                No Data!
            </EmptyDataTemplate>
        </asp:GridView>


    </div>
</asp:Content>
